import '../user_model.dart';

/// 注册响应模型
class RegisterResponse {
  /// 是否注册成功
  final bool success;
  
  /// 消息
  final String message;
  
  /// 用户信息
  final UserModel? user;
  
  /// 是否需要邮箱验证
  final bool requireEmailVerification;
  
  /// 构造函数
  RegisterResponse({
    required this.success,
    required this.message,
    this.user,
    this.requireEmailVerification = false,
  });
  
  /// 从JSON创建注册响应
  factory RegisterResponse.fromJson(Map<String, dynamic> json) {
    return RegisterResponse(
      success: json['success'] as bool,
      message: json['message'] as String,
      user: json['user'] != null
          ? UserModel.fromJson(json['user'] as Map<String, dynamic>)
          : null,
      requireEmailVerification: json['require_email_verification'] as bool? ?? false,
    );
  }
  
  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'success': success,
      'message': message,
      if (user != null) 'user': user!.toJson(),
      'require_email_verification': requireEmailVerification,
    };
  }
} 